#include <algorithm>
#include <vector>
using namespace std;
int findContentChildren(vector<int> &g, vector<int> &s) {
  int res = 0;
  sort(g.begin(), g.end());
  sort(s.begin(), s.end());
  int r1 = g.size() - 1;
  int r2 = s.size() - 1;
  while (r1 >= 0 && r2 >= 0) {
    if (s[r2] >= g[r1]) {
      res++;
      r2--;
      r1--;
    } else {
      r1--;
    }
  }
  return res;
}